{include file="public/head"}
{include file="public/left"}
<!-- content -->

<div class="main_02_r">

    <!--内容区域-->
    <div class="site_01">
        <span>当前位置：</span><a href="#">城事社</a><i>></i><a href="#">分类管理</a><i>></i><a href="#">便民号薄</a><i>></i><a href="#">号薄详情</a>
    </div>

    <div class="nrq_01">
        <div class="gg_01">
            <span class="on">号薄详情</span>
        </div>
        <div class="gg_02">
            <div class="gg_03">

                <div class="hbgl_01">
                    <div class="fl">
                        <a href="javascript:void(0);" class="on tjhb_click">添加号码</a>
                    </div>
                </div>

                <div class="bmhb_01">
                    <table cellpadding="0" cellspacing="0">
                        <tr>
                            <th>序号</th>
                            <th>分类名称</th>
                            <th>机构名称</th>
                            <th>电话号薄</th>
                            <th>联系地址</th>
                            <th>操作</th>
                        </tr>
                        {volist name="arr" id="vo"}
                        <tr>
                            <td>{$vo.id}</td>
                            <td>{$vo.classify_name}</td>
                            <td>{$vo.org_name}</td>
                            <td>
                                {$vo.directory_detail1|default=''}      {$vo.directory_detail2|default=''}      {$vo.directory_detail3|default=''}<br/>
                                {$vo.directory_detail4|default=''}      {$vo.directory_detail5|default=''}      {$vo.directory_detail6|default=''}
                            </td>
                            <td>{$vo.address}</td>
                            <td>
                                <a href="#" class="a_cz">编辑</a>
                                <a href="javascript:ajax_delete('{$vo.id}')" class="a_cz">删除</a>
                            </td>
                        </tr>
                        {/volist}
                    </table>
                </div>

                <div class="gg_03_b">
                    <div class="fl">
                        <span>共 <i>{$arr->total()}</i> 条</span><span>每页 <i>{$arr->listRows()}</i> 条</span>
                    </div>
                    <div class="fr">
                        {$arr->render()}
                    </div>
                </div>

            </div>
        </div>

    </div>

</div>

<!--添加编辑号薄弹窗-->
<div class="tjhb_fr">
    <div class="ggtcxq_bg"></div>
    <div class="ggtcxq_c">
        <div class="ggtcxq_cfr">
            <div class="ggtcxqc_t">
                <span>添加/编辑号码</span><a href="javascript:void(0);" class="close"></a>
            </div>
            <div class="tjhb_c">
                <form action="{:url('classify/ajax_details_add')}" class="ajax_details_form">
                <p>
                    <span>分类名称</span>
                    <input type="hidden" name="classify_id" class="tjhbc_txt" value="{$arr[0]['classify_id']}" />
                    <input type="text" class="tjhbc_txt" name="classify_name" value="{$arr[0]['classify_name']}" readonly  />

                </p>
                <p>
                    <span>机构名称</span>
                    <input type="text" name="org_name" class="tjhbc_txt" value="" placeholder="请输入机构名称" />
                </p>
                <p>
                    <span>电话号薄</span>
                    <input type="text" name="directory_detail1" class="tjhbc_txt1" value="" placeholder="请输入机构电话号薄" />
                    <a href="javascript:void(0);" class="a1"></a>
                </p>
                <p>
                    <span>&nbsp;</span>
                    <input type="text" name="directory_detail2" class="tjhbc_txt1" value="" placeholder="请输入机构电话号薄" />
                    <a href="javascript:void(0);" class="a1"></a>
                </p>
                <p>
                    <span>&nbsp;</span>
                    <input type="text" name="directory_detail3" class="tjhbc_txt1" value="" placeholder="请输入机构电话号薄" />
                    <a href="javascript:void(0);" class="a2"></a>
                </p>
                <p>
                    <span>&nbsp;</span>
                    <input type="text" name="directory_detail4" class="tjhbc_txt1" value="" placeholder="请输入机构电话号薄" />
                    <a href="javascript:void(0);" class="a2"></a>
                </p>
                <p>
                    <span>&nbsp;</span>
                    <input type="text" name="directory_detail5" class="tjhbc_txt1" value="" placeholder="请输入机构电话号薄" />
                    <a href="javascript:void(0);" class="a1"></a>
                </p>
                <p>
                    <span>&nbsp;</span>
                    <input type="text" name="directory_detail6" class="tjhbc_txt1" value="" placeholder="请输入机构电话号薄" />
                    <a href="javascript:void(0);" class="a1"></a>
                </p>
                <p>
                    <span>联系地址</span>
                    <input type="text" name="address" class="tjhbc_txt2" value="" placeholder="请点击选择联系地址" />
                </p>
                <p>
                    <span>&nbsp;</span>
                    <input type="button" class="tjhbc_btn ajax_details_submit" value="确定" />
                </p>
                </form>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    $(".tjhb_click").click(function () {
        $(".tjhb_fr").show();
        $(".tjhb_fr .ggtcxq_c").css({ "margin-top": "-" + $(".tjhb_fr .ggtcxq_c").height() / 2 + "px" });
    });
    $(".tjhb_fr .close").click(function () {
        $(".tjhb_fr").hide();
    });
    $(".tjhb_fr .ggtcxq_bg").click(function () {
        $(".tjhb_fr").hide();
    });
</script>

<script type="text/javascript">
    $(function(){
        var layer = layui.layer,form = layui.form;
        //添加一级分类
        $(".ajax_details_submit").click(function(){
            var url = $('.ajax_details_form').attr("action")?$('.ajax_details_form').attr("action"):"{:url()}";
            var data = $('.ajax_details_form').serialize();
            ajax_psot(url,data);
        });
    })

    function ajax_delete(id) {
        ajax_psot("{:url('classify/ajax_directory_delete')}",{"id":id})
    }

    function ajax_psot(url,data){
        $.ajax({
            url:url,
            type: "POST",//方法类型
            // dataType: "json",//预期服务器返回的数据类型
            data: data,
            success: function (data) {
                if (data.code === 1) {
                    layer.msg("<span style='margin-left: 18px;'>"+data.msg+"</span>",{icon: 1,time:1000},function(){
                        window.location.href=data.url;
                    });
                }else{
                    layer.msg("<span style='margin-left: 18px;'>"+data.msg+"</span>",{icon: 2,time:1000},function(){
                        /*if(data.url){
                            window.location.href=data.url;
                        }else{
                            location.reload();
                        }*/
                    });
                }
            },
            error : function() {
                layer.msg("<span style='margin-left: 18px;'>请求错误,请联系管理员</span>",{icon: 0,time:1000},function(){
                    //location.reload();
                });
            }
        });
    }
</script>
<!-- content -->
{include file="public/foot"}